<?php
    $url_1 = url_for('@detail?page='.($p), true);
    $url_2 = url_for('@detail?page='.($p+1), true);

    $url_1_encode = urlencode(url_for('@detail?page='.($p), true));
    $url_2_encode = urlencode(url_for('@detail?page='.($p+1), true));

    $prefix = "LIM2012_%s.jpg";

    $first_page_zero_filled = str_pad($p, 4, "0", STR_PAD_LEFT);
    $second_page_zero_filled = str_pad(($p+1), 4, "0", STR_PAD_LEFT);

    $image_url_1 = sprintf($prefix, $first_page_zero_filled);
    $image_url_2 = sprintf($prefix, $second_page_zero_filled);
?>

<?php use_stylesheet('cursor/cursor.css') ?>

<?php if($ie_version<=8){ ?>
  <div class="iebox" style="margin-bottom: 10px;">
    Esta página no está diseñada para su versión de Internet Explorer. Si desea ver la página como se pretende, por favor, utilice un navegador compatible con los estándares, como por ejemplo <a href="http://www.google.com/chrome" target="_blank">Google Chrome</a>.
  </div>
<?php } ?>

<table width="1200px" cellpadding="0" cellspacing="0" border="0">
  <tr>
    <td width="100px" align="center" valign="middle">
      <a href="javascript:void(0)" onclick="fakeSubmit('prev')">
        <?php echo image_tag('left_arrow.png') ?>
      </a>
    </td>
    <td width="500px">
        <?php echo image_tag('/uploads/pages/'.$image_url_1,'size=500x650 class="cursor"') ?>
        <table>
          <tr>
            <td width="150px" height="40px">
                <iframe src="//www.facebook.com/plugins/like.php?href=<?php echo $url_1_encode; ?>&amp;send=false&amp;layout=button_count&amp;width=150&amp;show_faces=false&amp;action=recommend&amp;colorscheme=light&amp;font=arial&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:150px; height:21px;" allowTransparency="true"></iframe>
            </td>
            <td width="150px">
                <iframe allowtransparency="true" frameborder="0" scrolling="no"
                src="https://platform.twitter.com/widgets/tweet_button.html?url=<?php echo urlencode($url_1); ?>&text=Páginas Amarillas <?php echo urlencode($url_1); ?>"
                style="width:130px; height:20px;"></iframe>
            </td>
          </tr>
        </table>
    </td>
    <td width="500px">
        <?php echo image_tag('/uploads/pages/'.$image_url_2,'size=500x650 class="cursor"') ?>
        <table>
          <tr>
            <td width="150px" height="40px">
                <iframe src="//www.facebook.com/plugins/like.php?href=<?php echo $url_2_encode; ?>&amp;send=false&amp;layout=button_count&amp;width=150&amp;show_faces=false&amp;action=recommend&amp;colorscheme=light&amp;font=arial&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:150px; height:21px;" allowTransparency="true"></iframe>
            </td>
            <td width="150px">
                <iframe allowtransparency="true" frameborder="0" scrolling="no"
                src="https://platform.twitter.com/widgets/tweet_button.html?url=<?php echo urlencode($url_2); ?>&text=Páginas Amarillas <?php echo urlencode($url_2); ?>"
                style="width:130px; height:20px;"></iframe>
            </td>
          </tr>
        </table>
    </td>
    <td width="100px" align="center" valign="middle">
      <a href="javascript:void(0)" onclick="fakeSubmit('next')">
        <?php echo image_tag('right_arrow.png') ?>
      </a>
    </td>
  </tr>
</table>
<form action="<?php echo url_for('@detail') ?>" method="post" id="frm" autocomplete="off">
    <input type="hidden" id="hdPage" name="page" value="<?php echo $p; ?>" />
    <input type="hidden" id="hdAction" name="hdAction" value="" />
<table width="100%">
  <tr>
    <td width="80px">
      <div class="btn" style="width: 80px;">
        <a href="javascript:void(0)" onclick="fakeSubmit('first')"><div>Inicio</div></a>
      </div>
    </td>
    <td width="340px">&nbsp;</td>
    <td width="100px">
      <div class="btn">
        <div>Pag. <?php echo $p; ?></div>
      </div>
    </td>
    <td width="100px">
      <div class="btn">
        <div>Pag. <?php echo ($p+1); ?></div>
      </div>
    </td>
    <td width="340px">&nbsp;</td>
    <td width="80px">
      <div class="btn" style="width: 80px;">
        <a href="javascript:void(0)" onclick="fakeSubmit('last')"><div>Fin</div></a>
      </div>
    </td>
  </tr>
</table>
<!--input type="text" size="2" id="page" value="<?php /*echo $p;*/ ?>" onkeypress="enterPressed(event, 'frm')" placeholder="Página" /-->
</form>
<script type="text/javascript">
function fakeSubmit(action){
    $("#frm #hdAction").val(action);
    $("#frm").submit();
}
</script>